//
//  MSPersonalHomepageController.m
//  觅尚
//
//  Created by No.8 on 2019/4/1.
//  Copyright © 2019 No.8. All rights reserved.
//

#import "MSPersonalHomepageController.h"
#import "MSDepartmentAttendanceCell.h"
#import "MSSexButton.h"
#import "MSMyDataCell.h"
#import "MSPersonalEditorController.h"
#import "MSAlbumModel.h"

@interface MSPersonalHomepageController ()<UITableViewDelegate,UITableViewDataSource,UIImagePickerControllerDelegate,UINavigationControllerDelegate>
{
    CustomNavigationBar *naviagtionBar;
}
/** 表视图*/
@property(nonatomic,strong)UITableView *tableView;

/** 图片*/
@property(nonatomic,strong)NSString *photoIMG;

/** 姓名*/
@property(nonatomic,strong)NSString *NameLabel;

/** 职位*/
@property(nonatomic,strong)NSString *positionLabel;

/** 性别*/
@property(nonatomic,strong)NSString * SexButton;


/** 性别*/
@property(nonatomic,strong)NSString * age;


/** 身高*/
@property(nonatomic,strong)NSString *heightlabel;


/** 地址*/
@property(nonatomic,strong)NSString *addressLabel;


/** 生日*/
@property(nonatomic,strong)UILabel *BirthdayLabel;


/** 国籍*/
@property(nonatomic,strong)UILabel *NationalityLabel;


/** 地址*/
@property(nonatomic,strong)UILabel *NativeLabel;


/** 特长*/
@property(nonatomic,strong)NSString *SpecialityLabel;

/** 特长*/
@property(nonatomic,strong)NSString *specialityStr;

/** <#name#>*/
@property(nonatomic,strong)UIImage *toutuImage;


/** 数组*/
@property(nonatomic,strong)NSMutableArray *DataArray;

/** 数组*/
@property(nonatomic,strong)NSMutableArray *IDArray;

/** <#name#>*/
@property(nonatomic,strong)UIImageView *Albumimage;

/** URL*/
@property(nonatomic,strong)NSString *URLStr;
@end

@implementation MSPersonalHomepageController
- (int)navBarBottom {
    if ([WRNavigationBar isIphoneX]) {
        return 88;
    } else {
        return 64;
    }
}
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:YES];
    
    self.DataArray = [NSMutableArray new];
    self.IDArray = [NSMutableArray new];
    self.navigationController.navigationBar.hidden = YES;
    dispatch_async(dispatch_get_main_queue(), ^{
        
        [self Relodata];
        
    });
    
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:YES];
    self.navigationController.navigationBar.hidden = YES;
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
//    [self CreateNavigationBar];
    
    self.view.backgroundColor = backgroundcolor;
    
   
    
    
    [self tableView];
    
    
}

- (void)Relodata{
    [self.DataArray removeAllObjects];
    
    NSDictionary * params = @{@"uid":[WYCAccountTool unarchiveuid]};
    
    [HTTPRequest POST:MSGetUserInfo params:params succeed:^(id responseObject) {
//        WYCLog(@"-------%@",responseObject);
        if (CodeStr) {
//            self.albumList = [MSAlbumModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"][@"albumList"]];
            MSAlbumModel * model = [[MSAlbumModel alloc] init];
            model.ID = @"00";
            [self.DataArray addObject:model];
            
            for (NSDictionary * dict in responseObject[@"data"][@"albumList"]) {
                MSAlbumModel * model = [MSAlbumModel mj_objectWithKeyValues:dict];
                [self.DataArray addObject:model];
            }
            
            
            self.photoIMG = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"user"][@"avatarUrl"]];
            
            self.NameLabel = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"user"][@"userName"]];
            
            self.positionLabel = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"user"][@"roleName"]];
             
            self.SexButton = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"user"][@"gender"]];
//            if ([genderStr isEqualToString:@"0"]) {
//                [self.SexButton setImage:[UIImage imageNamed:@"女"] forState:UIControlStateNormal];
//                [self.SexButton setTitle:@"女" forState:UIControlStateNormal];
//            }else{
//                [self.SexButton setImage:[UIImage imageNamed:@"男"] forState:UIControlStateNormal];
//                [self.SexButton setTitle:@"男" forState:UIControlStateNormal];
//            }
            
            self.heightlabel = [NSString stringWithFormat:@"%@cm",responseObject[@"data"][@"user"][@"height"]];
            
            self.addressLabel = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"user"][@"country"]];
            
            self.BirthdayLabel.text = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"user"][@"birthday"]];
            
            self.NationalityLabel.text = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"user"][@"country"]];
            
            self.NativeLabel.text = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"user"][@"province"]];
            
            self.age = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"user"][@"age"]];
//            self.SpecialityLabel.text = [];
            NSString *specialityStr = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"user"][@"speciality"]];
            self.specialityStr = specialityStr;
        }else{
            
            [MBManager showBriefAlert:responseObject[@"msg"]];
        }
         [self CreatView];
    } failure:^(NSError *error) {
        [MBManager showBriefAlert:Failed];
    }];
    
}
- (void)AddAlbumIMG{
    
    
}
- (void)CreatView{
    UIView * HeaderView = [[UIView alloc] init];
    HeaderView.x = 0;
    HeaderView.y = 0;
    HeaderView.width = ScreenWidth;
    HeaderView.backgroundColor = BackViewColor;
    
    
    
    UIView * ImageView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 800 * px)];
    UIImage*image = [UIImage imageNamed:@"wodetoutu"];
    ImageView.layer.contents = (__bridge id)image.CGImage;
    /** 设置对齐模式*/
    ImageView.layer.contentsGravity = kCAGravityResize;
    [HeaderView addSubview:ImageView];
    self.toutuImage = image;
    
    
    /** 个人主页标题*/
    UILabel * titlelabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth * 0.5 - 100 * px, [self navBarBottom], 200 * px, 60 * px)];
    titlelabel.textColor = [UIColor whiteColor];
    titlelabel.text = @"个人主页";
    titlelabel.textAlignment = NSTextAlignmentCenter;
    titlelabel.font = [UIFont systemFontOfSize:SYRealValue(30 / 2)];
    [HeaderView addSubview:titlelabel];
    
    
    
    
//
    
    /** 返回按钮*/
    
    UIButton * backButton = [[UIButton alloc] init];
    if ([WRNavigationBar isIphoneX]) {
        backButton.frame = CGRectMake(52 * px, 45, 30, 30);
    }else{
        backButton.frame = CGRectMake(52 * px, 30, 30, 30);
        
    }
    [backButton  setImage:[UIImage imageNamed:@"左箭头"] forState:UIControlStateNormal];
    [backButton  addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
    [HeaderView  addSubview:backButton];
    
    
    
    /** 设置*/
    UIButton * setButton = [[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth - 120 * px, backButton.y, 80 * px, 80 * px)];
    [setButton  setImage:[UIImage imageNamed:@"sz_icon"] forState:UIControlStateNormal];
    [setButton  addTarget:self action:@selector(setButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [HeaderView  addSubview:setButton];
    
    
    //头像
    UIImageView * photoIMG = [[UIImageView alloc] initWithFrame:CGRectMake(titlelabel.x, CGRectGetMaxY(titlelabel.frame) + 60 * px, 200 * px, 200 * px)];
    photoIMG.layer.cornerRadius = 100 * px;
    photoIMG.layer.masksToBounds = YES;
    photoIMG.image = [UIImage imageNamed:@"上传头像"];
    [photoIMG sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",self.photoIMG]] placeholderImage:[UIImage imageNamed:@"我的占位头像"]];
//    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickImage)];
//    [photoIMG addGestureRecognizer:tapGesture];
//    photoIMG.userInteractionEnabled = YES;
    [HeaderView addSubview:photoIMG];
    
    
    
    /** 昵称*/
    UILabel * NameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(photoIMG.frame) + 30 * px, ScreenWidth, 60 * px)];
    NameLabel.textColor = [UIColor whiteColor];
    NameLabel.text = [NSString stringWithFormat:@"%@",self.NameLabel];
    NameLabel.textAlignment = NSTextAlignmentCenter;
    NameLabel.font = [UIFont systemFontOfSize:SYRealValue(35 / 2)];
    [HeaderView addSubview:NameLabel];
    
    
    /** 按钮*/
    MSSexButton * SexButton = [[MSSexButton alloc] initWithFrame:CGRectMake(ScreenWidth / 3, CGRectGetMaxY(NameLabel.frame) + 10 * px, 100 * px, 50 * px)];
    if ([self.SexButton isEqualToString:@"0"]) {
        [SexButton setImage:[UIImage imageNamed:@"女"] forState:UIControlStateNormal];
        [SexButton setTitle:@"女" forState:UIControlStateNormal];
        SexButton.backgroundColor = WYCRGBColor(239, 138, 139);
    }else{
        [SexButton setImage:[UIImage imageNamed:@"男"] forState:UIControlStateNormal];
        [SexButton setTitle:@"男" forState:UIControlStateNormal];
         SexButton.backgroundColor = WYCRGBColor(95, 207, 185);
        
    }
    [SexButton setTitle:[NSString stringWithFormat:@"%@",self.age] forState:UIControlStateNormal];
    
    SexButton.titleLabel.font = [UIFont systemFontOfSize:SYRealValue(26 / 2)];
    [SexButton  setTitleColor:NameLabel.textColor forState:UIControlStateNormal];
    SexButton.layer.cornerRadius = 5 * px;
    [HeaderView  addSubview:SexButton];
    
    /** 身高*/
    UILabel * heightlabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(SexButton.frame) + 10 * px, SexButton.y, 150 * px, SexButton.height)];
    heightlabel.textColor = NameLabel.textColor;
    heightlabel.backgroundColor = WYCRGBColor(144, 134, 159);
    heightlabel.text = [NSString stringWithFormat:@"%@",self.heightlabel];
    heightlabel.layer.cornerRadius = 5 * px;
    heightlabel.textAlignment = NSTextAlignmentCenter;
    heightlabel.font = SexButton.titleLabel.font;
    [HeaderView addSubview:heightlabel];
    
    
    /** 位置*/
    UILabel * positionLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(heightlabel.frame)+ 10 * px, SexButton.y, heightlabel.width, heightlabel.height)];
    positionLabel.textColor = NameLabel.textColor;
    positionLabel.text =  [NSString stringWithFormat:@"%@",self.addressLabel];
    positionLabel.layer.cornerRadius = 5 * px;
    positionLabel.backgroundColor = WYCRGBColor(144, 134, 159);
    positionLabel.textAlignment = NSTextAlignmentCenter;
    positionLabel.font = heightlabel.font;
    [HeaderView addSubview:positionLabel];
//    self.addressLabel = positionLabel;
    
    
    /** 相册*/
    UILabel * AlbumLabel = [[UILabel alloc] initWithFrame:CGRectMake(backButton.x, CGRectGetMaxY(ImageView.frame) + 60 * px, 100 * px, 60 * px)];
    AlbumLabel.textColor = [UIColor grayColor];
    AlbumLabel.text = @"相册";
//    AlbumLabel.textAlignment =
    AlbumLabel.font = [UIFont systemFontOfSize:SYRealValue(30 / 2)];
    [HeaderView addSubview:AlbumLabel];
    
    
    //创建
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(backButton.x, CGRectGetMaxY(AlbumLabel.frame) + 30 * px, ScreenWidth - 52 * px, 300 * px)];
//    scrollView.showsHorizontalScrollIndicator=NO;
    //设置背景颜色
//    scrollView.backgroundColor = [UIColor redColor];
    
    //    //设置是否可以整页滚动
    scrollView.pagingEnabled = YES;
    
    scrollView.contentSize = CGSizeMake(220 * px * self.albumList.count, 300 * px);
    
    [HeaderView addSubview:scrollView];
    

    
    
    CGFloat AlbumimageH = scrollView.height;
    CGFloat AlbumimageY = 0;
    CGFloat AlbumimageW = 200 * px;
//    WYCLog(@"albumList-------%@",self.DataArray);
    for (int i = 0 ; i < self.DataArray.count; i++) {
        
        MSAlbumModel * model = self.DataArray[i];
//        WYCLog(@"-------%@",model.imgUrl);
//         [self.IDArray addObject:model.ID];
        /** 日历按钮*/
        UIImageView * Albumimage = [[UIImageView alloc] init];
        Albumimage.frame = CGRectMake((AlbumimageW + 20 * px) * i, AlbumimageY, AlbumimageW, AlbumimageH);
        Albumimage.backgroundColor = WYCRGBColor(54, 54, 68);
        Albumimage.tag = [model.ID intValue];
        [Albumimage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",model.imgUrl]] placeholderImage:[UIImage imageNamed:@"AddBTN"]];
        Albumimage.contentMode = UIViewContentModeScaleAspectFill;
        Albumimage.clipsToBounds = YES;
        Albumimage.layer.cornerRadius = 10 * px;
        Albumimage.layer.masksToBounds = YES;
        [scrollView addSubview:Albumimage];
        self.Albumimage = Albumimage;
//        WYCLog(@"-------长按了%d",i);
        if ([model.ID isEqualToString:@"00"]) {
            UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
            [Albumimage addGestureRecognizer:tapGesture];
            Albumimage.userInteractionEnabled = YES;
        }else{
//            WYCLog(@"-------%@",model.ID);
//            [self.IDArray addObject:model.ID];
            UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
            longPressGesture.minimumPressDuration = 1;
            longPressGesture.numberOfTouchesRequired = 1;
            [Albumimage addGestureRecognizer:longPressGesture];
            Albumimage.userInteractionEnabled = YES;
//            WYCLog(@"-------长按了%d",i);
        }
        
        
    }
    
    
    
    HeaderView.height = CGRectGetMaxY(scrollView.frame) + 60 * px;
    
    [self.view addSubview:HeaderView];
    
    self.tableView.tableHeaderView = HeaderView;
}

- (void)handleSingleTap:(UILongPressGestureRecognizer *)gestureRecognizer{
    UIAlertController *aler=[UIAlertController alertControllerWithTitle:@"添加相册" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    //从相机选取
    UIAlertAction *album = [UIAlertAction actionWithTitle:@"从相册选取" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
        UIImagePickerController *picker=[[UIImagePickerController alloc]init];
        picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        picker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:picker.sourceType];
        picker.allowsEditing = YES;
        picker.navigationBar.translucent = NO;
        picker.delegate = self;
        [self presentViewController:picker animated:YES completion:nil];
    }];
    
    //从相机选取
    UIAlertAction *camera=[UIAlertAction actionWithTitle:@"相机拍摄" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
        UIImagePickerController *picker = [[UIImagePickerController alloc]init];
        picker.sourceType = UIImagePickerControllerSourceTypeCamera;
        picker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:picker.sourceType];
        picker.allowsEditing = YES;
        picker.delegate = self;
        [self presentViewController:picker animated:YES completion:nil];
        
    }];
    
    UIAlertAction *cancl=[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
    [aler addAction:cancl];
    [aler addAction:album];
    [aler addAction:camera];
    [self presentViewController:aler animated:YES completion:nil];
}

//选取图片
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info
{
    UIImage *image1=[info objectForKey:UIImagePickerControllerEditedImage];
//    _photoImg.image = image1;
    
    
    [self dismissViewControllerAnimated:YES completion:nil];
    
    NSData *imageData = UIImageJPEGRepresentation(image1, 0.00001);
    
    NSString *encodedImageStr = [imageData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
    
    
    
    NSDictionary * params = @{@"file":encodedImageStr};
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    //申明返回的结果是json类型
    manager.responseSerializer = [AFJSONResponseSerializer serializer];
    //申明请求的数据是json类型
    manager.requestSerializer = [AFJSONRequestSerializer serializer];
    
    
    
    //如果报接受类型不一致请替换一致text/html或别的
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/plain", @"text/javascript", @"text/json", @"text/html",@"Type-Text",@"Content-Type", nil];
    
    //发送网络请求(请求方式为POST)
//    WYCLog(@"---%@",params);
    
    [manager POST:MSuploadAvatarUrl parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData) {
        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
        
        NSString *fileName = [NSString stringWithFormat:@"%@.png",[formatter stringFromDate:[NSDate date]]];
        
        [formData appendPartWithFileData:imageData name:@"file" fileName:fileName mimeType:@"image/png"];
        
    } progress:^(NSProgress * _Nonnull uploadProgress) {
        
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
         WYCLog(@"---%@",responseObject);
        if (CodeStr) {
//            [self Relodata];
            self.URLStr = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"url"]];
//            [MBManager showBriefAlert:responseObject[@"msg"]];
            [self createUseralbums];
        }else{
            [MBManager showBriefAlert:responseObject[@"msg"]];
        }
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        WYCLog(@"-----------%@",error);
    }];
    
    
}
- (void)createUseralbums{
    NSDictionary * params = @{@"uid":[WYCAccountTool unarchiveuid],@"imgUrl":self.URLStr};
    [HTTPRequest POST:MScreateUseralbums params:params succeed:^(id responseObject) {
        if (CodeStr) {
            [self Relodata];
            [MBManager showBriefAlert:responseObject[@"msg"]];
        }else{
            [MBManager showBriefAlert:responseObject[@"msg"]];
        }
    } failure:^(NSError *error) {
        [MBManager showBriefAlert:Failed];
    }];
    
}

- (void)longPress:(UIGestureRecognizer *)gestureRecognizer{
    WYCLogFunc;
    
    
        if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
            NSString * ID = [NSString stringWithFormat:@"%ld",(long)self.Albumimage.tag];
            NSDictionary * params = @{@"id":ID};
            [HTTPRequest POST:MSdeleteUseralbums params:params succeed:^(id responseObject) {
                if (CodeStr) {
                    [self Relodata];
                    [MBManager showBriefAlert:responseObject[@"msg"]];
                }else{
                    [MBManager showBriefAlert:responseObject[@"msg"]];
                }
            } failure:^(NSError *error) {
                [MBManager showBriefAlert:Failed];
            }];
        }else {
        }
    
    
//    }
    
    
}
/** 表视图*/
- (UITableView *)tableView{
    if (!_tableView) {
      
    if (@available(iOS 11.0, *)) {
        
        UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        
    } else {
        
        self.automaticallyAdjustsScrollViewInsets = NO;
        
    }
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight) style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.backgroundColor = [UIColor clearColor];
        _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        [self.view addSubview:self.tableView];
    }
    return _tableView;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 4;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 250 * px;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    MSMyDataCell * cell = [MSMyDataCell cellWithTableView:tableView];
    tableView.backgroundColor = [UIColor clearColor];
    //无色
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    if (indexPath.row == 0) {
        /** 生日*/
        UILabel * BirthdayTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(100 * px, 50 * px, 100 * px, 60 * px)];
        BirthdayTitleLabel.textColor = BackViewColor;
        BirthdayTitleLabel.text = @"生日";
        BirthdayTitleLabel.font = [UIFont systemFontOfSize:SYRealValue(28 / 2)];
        [cell addSubview:BirthdayTitleLabel];
        
        
        /** 生日*/
        UILabel * BirthdayLabel = [[UILabel alloc] initWithFrame:CGRectMake(BirthdayTitleLabel.x, CGRectGetMaxY(BirthdayTitleLabel.frame) + 20 * px, ScreenWidth * 0.5, BirthdayTitleLabel.height)];
        BirthdayLabel.textColor = [UIColor whiteColor];
        BirthdayLabel.textAlignment = NSTextAlignmentLeft;
        BirthdayLabel.font = [UIFont systemFontOfSize:SYRealValue(32 / 2)];
        [cell addSubview:BirthdayLabel];
        self.BirthdayLabel = BirthdayLabel;
    }else if (indexPath.row == 1) {
        /** 国籍*/
        UILabel * NationalityTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(100 * px, 50 * px, 100 * px, 60 * px)];
        NationalityTitleLabel.textColor = BackViewColor;
        NationalityTitleLabel.text = @"国籍";
        NationalityTitleLabel.font = [UIFont systemFontOfSize:SYRealValue(28 / 2)];
        [cell addSubview:NationalityTitleLabel];
        
        
        /** 生日*/
        UILabel * NationalityLabel = [[UILabel alloc] initWithFrame:CGRectMake(NationalityTitleLabel.x, CGRectGetMaxY(NationalityTitleLabel.frame) + 20 * px, ScreenWidth * 0.5, NationalityTitleLabel.height)];
        NationalityLabel.textColor = [UIColor whiteColor];
        NationalityLabel.textAlignment = NSTextAlignmentLeft;
        NationalityLabel.font = [UIFont systemFontOfSize:SYRealValue(32 / 2)];
        [cell addSubview:NationalityLabel];
        self.NationalityLabel = NationalityLabel;
    }else if (indexPath.row == 2) {
        /** 籍贯*/
        UILabel * NativeTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(100 * px, 50 * px, 100 * px, 60 * px)];
        NativeTitleLabel.textColor = BackViewColor;
        NativeTitleLabel.text = @"籍贯";
        NativeTitleLabel.font = [UIFont systemFontOfSize:SYRealValue(28 / 2)];
        [cell addSubview:NativeTitleLabel];
        
        
        /** 生日*/
        UILabel * NativeLabel = [[UILabel alloc] initWithFrame:CGRectMake(NativeTitleLabel.x, CGRectGetMaxY(NativeTitleLabel.frame) + 20 * px, ScreenWidth * 0.5, NativeTitleLabel.height)];
        NativeLabel.textColor = [UIColor whiteColor];
        NativeLabel.textAlignment = NSTextAlignmentLeft;
        NativeLabel.font = [UIFont systemFontOfSize:SYRealValue(32 / 2)];
        [cell addSubview:NativeLabel];
        self.NativeLabel = NativeLabel;
    }else {
        
        /** 籍贯*/
        UILabel * SpecialityTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(100 * px, 50 * px, 100 * px, 60 * px)];
        SpecialityTitleLabel.textColor = BackViewColor;
        SpecialityTitleLabel.text = @"特长";
        SpecialityTitleLabel.font = [UIFont systemFontOfSize:SYRealValue(28 / 2)];
        [cell addSubview:SpecialityTitleLabel];
        
        
        /** 生日*/
        UILabel * SpecialityLabel = [[UILabel alloc] initWithFrame:CGRectMake(SpecialityTitleLabel.x, CGRectGetMaxY(SpecialityTitleLabel.frame) + 20 * px, ScreenWidth * 0.5, SpecialityTitleLabel.height)];
        SpecialityLabel.textColor = [UIColor whiteColor];
        if ([self.specialityStr isEqualToString:@"1"]) {
            SpecialityLabel.text = @"歌曲";
        }else if ([self.specialityStr isEqualToString:@"2"]){
            SpecialityLabel.text = @"舞蹈";
        }else{
            SpecialityLabel.text = @"外语";
        }
        SpecialityLabel.textAlignment = NSTextAlignmentLeft;
        SpecialityLabel.font = [UIFont systemFontOfSize:SYRealValue(32 / 2)];
        [cell addSubview:SpecialityLabel];
    }
    return cell;
}
- (void)setButtonClick{
    
    WYCLogFunc;
    MSPersonalEditorController * personalVC = [[MSPersonalEditorController alloc] init];
    personalVC.gender = self.SexButton;
    [self.navigationController pushViewController:personalVC animated:NO];
    
}

- (void)backClick{
    
    [self.navigationController popViewControllerAnimated:NO];
}

@end
